
<template>
  <view class="container">
    <view class="form-item">
      <input type="text" placeholder="请输入用户名" v-model="username" />
    </view>
    <view class="form-item">
      <input type="password" placeholder="请输入密码" v-model="password" />
    </view>
    <button @click="login">登录</button>
  </view>
</template>
 
<script>
export default {
  data() {
    return {
      username: '',
      password: ''
    };
  },
  methods: {
    login() {
      if (!this.username || !this.password) {
        uni.showToast({
          title: '用户名和密码不能为空',
          icon: 'none'
        });
        return;
      }
      uni.showToast({
        title: '登录成功',
        icon: 'success'
      });
	  uni.redirectTo({
	    url: 'pages/homePage/homePage' // 跳转到对应路径的页面
	  });
    }
  }
};
</script>
 
<style>
.container {
  padding: 50px;
}
.form-item {
  margin-bottom: 20px;
}
input {
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 5px;
  width: 100%;
}
button {
  background-color: #007aff;
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  border: none;
  margin-top: 20px;
}
</style>